1 /* 2 * The MIT License (MIT) 3 * 4 * Copyright (c) 2014 Devisualization (Richard Andrew Cattermole) 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in all 14 * copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * SOFTWARE. 23 */ 24 module devisualization.util.opengl.function_wrappers.v11; 25 import gl = derelict.opengl3.gl; 26 public import devisualization.util.opengl.function_wrappers.v10 : BindTextureTarget, InternalFormat; 27 28 // no need to polute name space any further when its args don't change 29 public import derelict.opengl3.gl : glPolygonOffset, glIsTexture; 30 31 enum Primitives { 32 Points = gl.GL_POINTS, 33 LineStrip = gl.GL_LINE_STRIP, 34 LineLoop = gl.GL_LINE_LOOP, 35 Lines = gl.GL_LINES, 36 LineStripAdjacency = gl.GL_LINE_STRIP_ADJACENCY, 37 LinesAdjacency = gl.GL_LINES_ADJACENCY, 38 TriangleStrip = gl.GL_TRIANGLE_STRIP, 39 TriangleFan = gl.GL_TRIANGLE_FAN, 40 Triangles = gl.GL_TRIANGLES, 41 TriangleStripAdjacency = gl.GL_TRIANGLE_STRIP_ADJACENCY, 42 TrianglesAdjacency = gl.GL_TRIANGLES_ADJACENCY, 43 Patches = gl.GL_PATCHES 44 } 45 46 enum CompressedTextureTargets2D { 47 Texture2D = gl.GL_TEXTURE_2D, 48 TextureCubeMapPositiveX = gl.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 49 TextureCubeMapNegativeX = gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 50 TextureCubeMapPositiveY = gl.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 51 TextureCubeMapNegativeY = gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 52 TextureCubeMapPositiveZ = gl.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 53 TextureCubeMapNegativeZ = gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 54 } 55 56 void glDrawArrays(Primitives mode, int first, int count) { 57 gl.glDrawArrays(cast(gl.GLenum)mode, first, count); 58 } 59 60 void glDrawElements(Primitives mode, ubyte[] indices) { 61 gl.glDrawElements(cast(gl.GLenum)mode, cast(uint)indices.length, gl.GL_UNSIGNED_BYTE, cast(void*)indices.ptr); 62 } 63 64 void glDrawElements(Primitives mode, ushort[] indices) { 65 gl.glDrawElements(cast(gl.GLenum)mode, cast(uint)indices.length, gl.GL_UNSIGNED_SHORT, cast(void*)indices.ptr); 66 } 67 68 void glDrawElements(Primitives mode, uint[] indices) { 69 gl.glDrawElements(cast(gl.GLenum)mode, cast(uint)indices.length, gl.GL_UNSIGNED_INT, cast(void*)indices.ptr); 70 } 71 72 void glCopyTexImage1D(int level, InternalFormat internalFormat, int x, int y, int width) { 73 gl.glCopyTexImage1D(gl.GL_TEXTURE_1D, level, cast(gl.GLenum)internalFormat, x, y, width, 0); 74 } 75 76 void glCopyTexImage2D(CompressedTextureTargets2D target, int level, InternalFormat internalFormat, int x, int y, int width, int height) { 77 gl.glCopyTexImage2D(cast(gl.GLenum)target, level, cast(gl.GLenum)internalFormat, x, y, width, height, 0); 78 } 79 80 void glCopyTexSubImage1D(int level, int xoffset, int x, int y, int width) { 81 gl.glCopyTexSubImage1D(gl.GL_TEXTURE_1D, level, xoffset, x, y, width); 82 } 83 84 void glCopyTexSubImage2D(CompressedTextureTargets2D target, int level, int xoffset, int yoffset, int x, int y, int width, int height) { 85 gl.glCopyTexSubImage2D(cast(gl.GLenum)target, level, xoffset, yoffset, x, y, width, height); 86 } 87 88 void glBindTexture(BindTextureTarget target, uint texture) { 89 gl.glBindTexture(cast(gl.GLenum)target, texture); 90 } 91 92 void glDeleteTextures(uint[] textures) { 93 gl.glDeleteTextures(cast(uint)textures.length, textures.ptr); 94 } 95 96 void glDeleteTextures(uint texture) { 97 gl.glDeleteTextures(1, &texture); 98 } 99 100 uint glGenTexture() { 101 uint ret; 102 gl.glGenTextures(1, &ret); 103 return ret; 104 } 105 106 uint[] glGenTextures(int n) { 107 uint[] ret; 108 gl.glGenTextures(n, ret.ptr); 109 return ret; 110 }